home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / Fs_WriteBack.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-19  |  1.7 KB  |  62 lines

  1. /* 
  2.  * Fs_WriteBack.c --
  3.  *
  4.  *    Source code for the Fs_WriteBack library procedure.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: Fs_WriteBack.c,v 1.1 88/06/19 14:29:15 ouster Exp $ SPRITE (Berkeley)";
  18. #endif not lint
  19.  
  20. #include <sprite.h>
  21. #include <fs.h>
  22.  
  23.  
  24. /*
  25.  *----------------------------------------------------------------------
  26.  *
  27.  * Fs_WriteBack --
  28.  *
  29.  *    Force the given file to disk.
  30.  *
  31.  * Results:
  32.  *    SUCCESS if could open and force to disk, an error otherwise.
  33.  *
  34.  * Side effects:
  35.  *    File forced to disk.
  36.  *
  37.  *----------------------------------------------------------------------
  38.  */
  39. ReturnStatus
  40. Fs_WriteBack(fileName, firstByte, lastByte, shouldBlock)
  41.     char    *fileName;        /* Name of file to write back. */
  42.     int        firstByte;        /* First byte to write back, -1 if 
  43.                      * should write-back the lowest first
  44.                      * byte */
  45.     int        lastByte;        /* Last byte to write back, -1 if 
  46.                      * should write-back the highest last
  47.                      * byte */
  48.     Boolean    shouldBlock;        /* TRUE => should wait for the file
  49.                      * to be put on disk. */
  50. {
  51.     int            fd;
  52.     ReturnStatus    status;
  53.  
  54.     status = Fs_Open(fileName, FS_READ, 0, &fd);
  55.     if (status != SUCCESS) {
  56.     return(status);
  57.     }
  58.     status = Fs_WriteBackID(fd, firstByte, lastByte, shouldBlock);
  59.     Fs_Close(fd);
  60.     return(status);
  61. }
  62.